package lxs.tool.liberator.work.controller;

import lxs.tool.liberator.common.base.result.Response;
import lxs.tool.liberator.work.param.in.ColumnIn;
import lxs.tool.liberator.work.service.ColumnService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("work/column")
public class ColumnController {
    @Autowired
    private ColumnService columnService;

    @GetMapping("showTable")
    public Response showTable() throws Exception {
        return columnService.showTable();
    }

    @GetMapping("getMeta")
    public Response getMeta() throws Exception {
        return columnService.getMeta();
    }

    @GetMapping("getListByClassId")
    public Response getListByClassId(String id) {
        return columnService.getListByClassId(id);
    }

    @PostMapping("setRules")
    public Response setRules(@RequestBody ColumnIn in) {
        return columnService.setRules(in);
    }

    @GetMapping("setLink")
    public Response setLink(String link, String id) {
        return columnService.setLink(link, id);
    }

    @GetMapping("getMultiOptions")
    public Response getMultiOptions() {
        return columnService.getMultiOptions();
    }

    @GetMapping("getOptionsByClassId")
    public Response getOptionsByClassId(String id) {
        return columnService.getOptionsByClassId(id);
    }

    @GetMapping("getOptionsByClassIdAndHaveLink")
    public Response getOptionsByClassIdAndHaveLink(String cid) {
        return columnService.getOptionsByClassIdAndHaveLink(cid);
    }

    @GetMapping("getColumnTreeByClassId")
    public Response getColumnTreeByClassId(String id) {
        return columnService.getColumnTreeByClassId(id);
    }

    @GetMapping("getOptionsByInterfaceId")
    public Response getOptionsByInterfaceId(String id) {
        return columnService.getOptionsByInterfaceId(id);
    }
}
